<?php

class User_manage extends Controller {

	function User_manager ()
	{
		parent::Controller();
	}
	
	function index()
	{
		$this->load->view('enter');
	}
	
	function enter()
	{   
		$this->load->model('user_manage_model');
		$result = $this->user_manage_model->judge_pass($_POST['pass']);
		
		if($result == 0)
		{
			$this->load->database(); 
			$result = $this->db->get('user_manage');
			$data['users'] = $result->result();
			$this->load->view('user_list',$data);
		}
		else echo "password error";
	}
	
	function modify()
	{   
        $this->load->view('modify',$_POST);
	}
	
	function save_modify()
	{   
        $this->load->database();
		$this->load->model('user_manage_model');
		$this->user_manage_model->save_modify($_POST);
	}
	
	function delete_user()
	{   
		$this->load->database();
		$this->load->model('user_manage_model');
		$this->user_manage_model->delete_user($_POST['id']);
		
	}
	
	function add()
	{   
        $this->load->view('add');
	}
	
	function save_add()
	{   
        $this->load->database();
		$this->load->model('user_manage_model');
		$this->user_manage_model->save_add($_POST);
	}
}
?>